home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Misc
/
InstallerNG
/
developer
/
gui
/
example
/
igui_CopylibConfirm.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-01
|
4KB
|
163 lines
#include "includes.h"
#include "installergui_data.h"
/********************************************************************
*
* DESCRIPTION
*
* you all know the panl which pops up, when the installer
* is up to copy files with respect to their versions. well,
* here it is... the source and destination file data are
* described by special iguicl_FileSpec structures, which
* are given by the installer itself. you simply build the
* strings to be shown from the (localized?) patterns and
* wait for users response. thats it :=)
*
* IN: application - pointer to the private application structure
* localenv - the local environment of the related COPYLIB function
* src
* dest - iguicl_FileSpec of the source and destination file
*
* OUT: 1 - if the user choses "Proceed"
* 0 - if the user choses "Skip"
*
*/
/********************************************************************
*
* STATIC
*
*/
/********************************************************************
*
* EXTERN
*
*/
/********************************************************************
*
* PUBLIC
*
*/
/********************************************************************
*
* CODE
*
*/
long __asm igui_CopylibConfirm(register __a0 APTR application,
register __a1 struct FunctionEnvironment *localenv,
register __a2 struct iguicl_FileSpec *src,
register __a3 struct iguicl_FileSpec *dest)
{
#ifdef DEBUG
DEBUG_MAKRO
#endif
{
struct Application *app = (struct Application *) application;
char *body;
APTR obj;
long retval = 1,
event,
args[7];
// create an arg-array for the StringF function
args[0] = (long) src->ifs_FileName;
args[1] = src->ifs_Version;
args[2] = src->ifs_Revision;
args[3] = src->ifs_FileSize;
args[4] = (long) src->ifs_DateString;
args[6] = localenv->fe_Dest;
// if the destination file exists, use its data!
if (dest->ifs_Exists)
{
char *body2;
long args2[4];
args[5] = (long) app->app_Texts[COPYLIB_VERSION];
args2[0] = dest->ifs_Version;
args2[1] = dest->ifs_Revision;
args2[2] = dest->ifs_FileSize;
args2[3] = (long) dest->ifs_DateString;
body2 = sav_StringF2(app->app_Texts[COPYLIB_PATTERN], &args);
if (!body2) { /* OUT OF MEMORY */ return(0); }
body = sav_StringF2(body2, &args2);
sav_FreeVec(body2);
}
// no destination file!
else
{
args[5] = (long) app->app_Texts[COPYLIB_NOVERSION];
body = sav_StringF2(app->app_Texts[COPYLIB_PATTERN], &args);
}
// there was not enough free memory, to create the formatted text
if (!body) { /* OUT OF MEMORY */ return(0); }
else
{
// after we created the text, we can now create the object itself
obj = GroupObject,
Child, HVSpace,
Child, TextObject,
MUIA_Frame, MUIV_Frame_None,
MUIA_Text_Contents, localenv->fe_Prompt,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, TextObject,
MUIA_Background, MUII_TextBack,
//MUIA_Frame, MUIV_Frame_Text,
MUIA_Text_Contents, body,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, HVSpace,
End;
// set the help text for this function
igui_SetHelp(app, (char *) localenv->fe_Help);
//
if (guistuff_NewContent(app, obj))
{
// make the "cancel" button into a "skip this part" button
igui_NameCancel(app, app->app_Texts[BUTTON_SKIP]);
// wait, until the user "proceeds", "skips" or confirms the "quit" action
do
{
event = igui_QuietWaitApp(app);
if (event == GUIEVENT_PROCEED) { retval = 1; break; }
else if (event == GUIEVENT_ABORT) { retval = 0; break; }
}
while (guistuff_HandleGUIEvent(app, event));
// restore the "cancel" button
igui_NameCancel(app, app->app_Texts[BUTTON_CANCEL]);
}
// free the memory of the body-text
sav_FreeVec(body);
}
//
igui_EmptyPanel(app);
return(retval);
}
}